<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::group(['prefix'=>'v1','namespace'=>'Api','middleware'=>'cors'],function(){

    //获取token
    Route::post('login','AuthController@login');

    //文件上传
    Route::post('upload','CommonController@uploads');



    //需要token的路由
    Route::group(['middleware' => 'auth:api'],function(){


        //我的未读消息
        Route::get('message/count','AuthController@messageCount');

        //我的消息列表
        Route::get('message/init','AuthController@messageList');
        //消息内容
        Route::get('message/content','AuthController@messageContent');
        //设置已读
        Route::post('message/has_read','AuthController@hasRead');
        //软删除消息
        Route::post('message/remove_readed','AuthController@removeReaded');
        //还原消息
        Route::post('message/restore','AuthController@restore');
        //消息通知
        Route::get('message/notice','AuthController@notice');


         //回购列表导出
        Route::post('huibuy/expprt','ExportController@huibuy');

        //提现导出
        Route::post('tixian/expprt','ExportController@tixian');

        //个人流水导出
        Route::post('memberdraw/expprt','ExportController@memberdraw');

        //团队流水导出
        Route::post('memberdrawgroup/expprt','ExportController@memberdrawgroup');


        //公用修改状态
        Route::post('common/status','CommonController@changeStatus');

        //退出登录
        Route::post('logout','AuthController@logout');

        //管理员信息
        Route::post('userinfo','AuthController@userinfo');
        //首页信息
        Route::post('index','IndexController@index');


        //系统设置
        Route::group(['namespace'=>'System'],function(){

            //管理员
            Route::resource('admin','AdminController');
            //角色
            Route::resource('role','RolesController');

            //设置角色权限
            Route::post('assign_roles','AdminLogic@assignRoles');
            //撤销角色权限
            Route::post('sync_permissions_roles','AdminLogic@syncPermissionsRoles');

        });

         //会员管理
        Route::group(['namespace'=>'Members'],function(){

             //会员列表
            Route::resource('member','MembersController');
            //提现列表
            Route::resource('draw','MemberDrawController');

            //会员列表-我的流水
            Route::resource('member_flow','MemberPipelineController');

            //会员列表-我的团队流水
            Route::resource('member_group_flow','MembersGroupController');
        });


        //财务管理
        Route::group(['namespace'=>'Finance'],function(){

             //支付订单
            Route::resource('pay/order','PayOrderController');
        });

         //商品管理
        Route::group(['namespace'=>'Goods'],function(){
            //商品列表
            Route::resource('goods','GoodsController');
            //订单
            Route::resource('order_goods','OrderController');
        });

        //房间管理
        Route::group(['namespace'=>'Room'],function(){

            //竞猜商品列表
            Route::resource('room/goods','GoodsController');

            //竞猜管理
            Route::resource('rooms_goods','RoomGoodsController');

            //房间等级
            Route::resource('room/level','RoomLevelController');

            //商品分类
            Route::resource('room/goods_cate','GoodsCateController');

            //回购列表
            Route::resource('room/huibuy','HuibuyController');

            //发货列表
            Route::resource('room/shopping','ShoppingController');
        });

        Route::group(['namespace'=>'Operate'],function(){
            // 轮播图
            Route::resource('banners','BannerController');

            //app设置
            Route::resource('appsetting','AppSettingController');
        });

    });

});
